package com.bookmanger.server.service;

import com.bookmanger.common.result.Result;
import com.bookmanger.pojo.DTO.BorrowDTO;
import com.bookmanger.pojo.Entity.BorrowEntity;
import com.bookmanger.pojo.VO.BorrowBook4ManagerVO;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public interface BorrowService {
    Integer borrowBook(Integer readerId, Integer bookId, LocalDateTime informTime);
    boolean borrowBook(BorrowDTO borrowDTO);
    Result approveBorrow(Integer borrowId, Integer managerId);
    boolean returnBook(Integer borrowId);
    boolean approveReturnBook(Integer borrowId, Integer managerId);
    boolean handleDamagedOrLostBook(Integer borrowId, String damageOrLostCause);
    
    // 查询借书申请
    PageInfo<BorrowEntity> getPendingBorrowApplications(Integer page, Integer pageSize);
    PageInfo<BorrowEntity> getApprovedBorrowApplications(Integer page, Integer pageSize);
    
    // 查询还书申请
    PageInfo<BorrowEntity> getPendingReturnApplications(Integer page, Integer pageSize);
    PageInfo<BorrowEntity> getApprovedReturnApplications(Integer page, Integer pageSize);
    
    // 查询借书申请(详细信息)
    PageInfo<BorrowBook4ManagerVO> getPendingBorrowApplicationsWithDetails(Integer page, Integer pageSize);
    PageInfo<BorrowBook4ManagerVO> getApprovedBorrowApplicationsWithDetails(Integer page, Integer pageSize);
    
    // 查询还书申请(详细信息)
    PageInfo<BorrowBook4ManagerVO> getPendingReturnApplicationsWithDetails(Integer page, Integer pageSize);
    PageInfo<BorrowBook4ManagerVO> getApprovedReturnApplicationsWithDetails(Integer page, Integer pageSize);
    
    // 根据用户ID或名称模糊查询借阅记录
    PageInfo<BorrowBook4ManagerVO> getBorrowRecordsByUserIdOrName(String keyword, Integer page, Integer pageSize);
}